package com.wz.wiki.service.impl;

import com.wz.wiki.mapper.DocMapper;
import com.wz.wiki.websocket.WebSocketServer;
import org.slf4j.MDC;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author 王哲
 * @Contact 1121586359@qq.com
 * @ClassName WebSocketService.java
 * @create 2023年07月03日 下午4:51
 * @Description websocket业务
 * @Version V1.0
 */
@Component
public class WebSocketService {

    @Resource
    private WebSocketServer webSocketServer;

    @Resource
    private DocMapper docMapper;

    @Async // 异步调用
    public void sendWebSocketMsg(String message,String logId) {
        MDC.put("LOG_ID", logId);
        // 点赞完成 推送消息
        webSocketServer.sendInfo(message);
    }

}
